#ifndef __variable_h__ 
 
#define __variable_h__  
 
/*Radio Variable */  
#define RADIO_FM1     0  
#define RADIO_FM2     1  
#define RADIO_AM      2 
#define RADIO_BANDMAX 3 
#define RADIO_CHMAX   8 
 
extern unsigned char RadioBand;/* FM1 0 FM2 1 AM 2 */  
 
extern unsigned char FreqTab[RADIO_BANDMAX][RADIO_CHMAX]; 
extern unsigned char RadioFreq;  
extern unsigned char RadioFreOff;  
 
extern unsigned char RadioFreCH;//当前频率通道 
 
  
/*  Systerm Variable */ 
extern unsigned char StatusFlag; 
extern unsigned char SoundVolume; 
extern unsigned char SourceMode;  
#define SourceNoSign    0 
#define SourceDvd       1 
#define SourceRadio     2 
#define SourceDvc       3 
#define SourceTv        4 
#define SourceGps       5 
#define SourceAux1      6 
#define SourceAux2      7 
#define SourceAux3      8 
 
#define SOURCEMAX       8 
 
#define ACCDETFlag     0 
#define LIGHTDETFlag   1 
#define BACKCARDETFlag 2 
extern unsigned char DetectFlag; 
 
/* 
   RTCFlag 
           bit0  用于读取Dvd的时间 
           bit1  读取dvd的状态 
           bit2  Radio自动收台而且已经收好一台，准备存储 
*/ 
 
/* 
    DisplayFlag 
								Bit0  1:Audio_Display on 0:Audio_Display off 
								Bit1  1:Video_Display on 0:Video_Display off 
*/ 
#define Sound_Display  0 
#define Video_Display  1 
extern unsigned char DisplayFlag;//windows display 
 
extern unsigned char SysMenuDisplayFlg; 
 
//#define IEBusTxFlg  0 
//#define IEBusRxFlg  1 
extern uchar StatusFlag; 
 
 
#define PowOn           SetBit(StatusFlag,7) 
#define PowOff          ClrBit(StatusFlag,7) 
#define PowVal          ValBit(StatusFlag,7) 
 
#define ConnectOk       SetBit(StatusFlag,6) 
#define ConnectNo       ClrBit(StatusFlag,6) 
#define ConnectVal      ValBit(StatusFlag,6) 
 
#define SysWindowsOn    SetBit(StatusFlag,5) 
#define SysWindowsOff   ClrBit(StatusFlag,5) 
#define SysWindowsVal   ValBit(StatusFlag,5) 
 
 
 
#define IEBusRxFlagSet  SetBit(StatusFlag,1) 
#define IEBusRxFlagClr  ClrBit(StatusFlag,1) 
#define IEBusRxFlagVal  ValBit(StatusFlag,1) 
 
#define IEBusTxFlagSet  SetBit(StatusFlag,0) 
#define IEBusTxFlagClr  ClrBit(StatusFlag,0) 
#define IEBusTxFlagVal  ValBit(StatusFlag,0) 
 
extern uchar WindowDispFlag; 
#define NO_WINDOW        0 
#define VIDEO_WINDOW     1 
#define SOUND_WINDOW     2 
#define USR_WINDOW       3  
#define DVC_WINDOW       4 
//#define VideoWindowsOn  SetBit(StatusFlag,4) 
//#define VideoWindowsOff ClrBit(StatusFlag,4) 
//#define VideoWindowsVal ValBit(StatusFlag,4) 
  
 
/*  IEBus Variable */ 
#define IEBus_RHAddr       IEBus_RxBuf[0] 
#define IEBus_RLAddr       IEBus_RxBuf[1] 
#define IEBus_RLength      IEBus_RxBuf[2] 
#define IEBus_RData0       IEBus_RxBuf[3] 
#define IEBus_RData1       IEBus_RxBuf[4] 
#define IEBus_RData2       IEBus_RxBuf[5] 
#define IEBus_RData3       IEBus_RxBuf[6] 
#define IEBus_RData4       IEBus_RxBuf[7] 
#define IEBus_RData5       IEBus_RxBuf[8] 
#define IEBus_RData6       IEBus_RxBuf[9] 
extern unsigned char IEBus_RxBuf[]; 
extern unsigned char IEBus_RxDataLength; 
 
#define IEBus_TBroadcast   IEBus_TxBuf[0] 
#define IEBus_THAddr       IEBus_TxBuf[1] 
#define IEBus_TLAddr       IEBus_TxBuf[2] 
#define IEBus_TLength      IEBus_TxBuf[3] 
#define IEBus_TData0       IEBus_TxBuf[4] 
#define IEBus_TData1       IEBus_TxBuf[5] 
#define IEBus_TData2       IEBus_TxBuf[6] 
#define IEBus_TData3       IEBus_TxBuf[7] 
#define IEBus_TData4       IEBus_TxBuf[8] 
#define IEBus_TData5       IEBus_TxBuf[9] 
extern unsigned char IEBus_TxBuf[]; 
extern unsigned char IEBus_TxDataLength; 
 
 
/*############# Display Menu #####################*/ 
//Sound  
#define SOUNDMENU_NUM    4 
extern  unsigned char SoundMenuCnt; 
extern  unsigned char SoundMenu[SOUNDMENU_NUM]; 
#define SoundMenuBass		    SoundMenu[0]//-7 ~ +7  
#define SoundMenuTreb		    SoundMenu[1]//-7 ~ +7  
#define SoundMenuFlat		    SoundMenu[2]//-8 ~ +8  
#define SoundMenuBalance	    SoundMenu[3]//-8 ~ +8  
 
#define NUM_BASS         0 
#define NUM_TREB         1 
#define NUM_FLAT         2 
#define NUM_BALANCE      3 
 
extern unsigned char Volume; 
 
 
//Video 
#define VIDEOMENU_NUM    5 
extern  unsigned char VideoMenuCnt; 
extern  unsigned char VideoMenu[VIDEOMENU_NUM]; 
 
#define NUM_BRIGHT   0 
#define NUM_COLOR    1 
#define NUM_CONT     2 
#define NUM_REV      3 
#define NUM_MODE     4 
 
 
#define VideoMenuBright             VideoMenu[NUM_BRIGHT] 
#define VideoMenuColor              VideoMenu[NUM_COLOR] 
#define VideoMenuCont               VideoMenu[NUM_CONT] 
#define VideoMenuRev                VideoMenu[NUM_REV] 
#define VideoMenuMode               VideoMenu[NUM_MODE] 
 
//VideoSYS 
#define SYSMENU_NUM    8 
extern unsigned char SysMenuCnt; 
extern unsigned char SysMenu[SYSMENU_NUM]; 
 
#define NUM_BRIGHT   0 
#define NUM_COLOR    1 
#define NUM_CONT     2 
#define NUM_PIC      3 
#define NUM_TINT     4 
#define NUM_COM      5 
#define NUM_SUBR     6 
#define NUM_SUBB     7 
 
 
#define SysMenuBright             SysMenu[NUM_BRIGHT] 
#define SysMenuColor              SysMenu[NUM_COLOR] 
#define SysMenuCont               SysMenu[NUM_CONT] 
#define SysMenuPic                SysMenu[NUM_PIC] 
#define SysMenuTint               SysMenu[NUM_TINT] 
#define SysMenuCom                SysMenu[NUM_COM] 
#define SysMenuSubr               SysMenu[NUM_SUBR] 
#define SysMenuSubb               SysMenu[NUM_SUBB] 
 
//usr setting 
#define USRMENU_NUM    4 
extern unsigned char   UsrMenu;//8bit on/off 
extern unsigned char   UsrMenuCnt; 
//extern unsigned char   UsrMenu[USRMENU_NUM]; 
 
#define NUM_DATA   0 
#define NUM_TIME   1 
#define NUM_BEEP   2 
#define NUM_CCD    3 
 
//#define UsrData     UsrMenu[NUM_DATA] 
//#define UsrTime     UsrMenu[NUM_TIME] 
//#define UsrBeep     UsrMenu[NUM_BEEP] 
//#define UsrCcd      UsrMenu[NUM_CCD] 
 
/*################################################*/  
 
 
/* OSD Buff */ 
extern unsigned char OsdBuf[]; 
 
/* ADC variable*/ 
extern unsigned char AdcResult; 
 
extern unsigned char KeyCurrent; 
extern unsigned char KeyPrevious; 
extern unsigned int  KeyCount; 
 
extern unsigned char KeyFlag; 
 
#define KeySuccessFlagSet  SetBit(KeyFlag,7) 
#define KeySuccessFlagClr  ClrBit(KeyFlag,7) 
#define KeySuccessFlagVal  ValBit(KeyFlag,7) 
 
#define KeyLongFlagSet     SetBit(KeyFlag,6) 
#define KeyLongFlagClr     ClrBit(KeyFlag,6) 
#define KeyLongFlagVal     ValBit(KeyFlag,6) 
 
#define AUX_CHSetAD0       ClrBit(KeyFlag,0)  
#define AUX_CHSetAD1       SetBit(KeyFlag,0) 
#define AUX_CHVal          ValBit(KeyFlag,0) 
 
 
extern unsigned int RTCCount; 
 
 
/* REMO */ 
extern unsigned char RedSuccess; 
extern unsigned char RedLong; 
extern unsigned char RedRead; 
extern unsigned char RedData[4]; 
extern unsigned char RedCmd; 
extern unsigned char RedCnt; 
extern unsigned char RedCount; 
 
extern unsigned char SetHour; 
extern unsigned char SetMinute; 
extern unsigned char SetYear; 
extern unsigned char SetMonth; 
extern unsigned char SetData; 
 
extern unsigned char Hour; 
extern unsigned char Minute; 
extern unsigned char Year; 
extern unsigned char Month; 
extern unsigned char Data; 
 
#endif 